import 'package:common_utils/common_utils.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:sp_util/sp_util.dart';
import 'app/routes/app_pages.dart';
import 'theme/theme.dart';

Future<void> main() async {

	LogUtil.init(isDebug: kDebugMode);
  WidgetsFlutterBinding.ensureInitialized();
  await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
	await SpUtil.getInstance();

	var currentThemeName=SpUtil.getString('currentThemeName')??"默认";
	var currentTheme=AppTheme.themeList.firstWhere((item)=>item.name==currentThemeName,orElse:() => AppTheme.themeList[0]);
	runApp(
		GetMaterialApp(
			title: "Application",
			debugShowCheckedModeBanner: false,
			theme: currentTheme.data,
			initialRoute: AppPages.INITIAL,
			getPages: AppPages.routes,
		),
	);
}
